package com.jianguozh.difs.support.api.ops.dto;

import com.baomidou.mybatisplus.annotation.TableName;
import com.jianguozh.difs.framework.validator.EnumValid;
import com.jianguozh.difs.framework.validator.UniqueValid;
import com.jianguozh.difs.framework.validator.group.UpdateGroup;
import com.jianguozh.difs.support.service.constant.enums.OrgEnum;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * 用户dto
 *
 * @author hanrs
 * @email 4076130@qq.com
 * @since 2022/3/24 17:19
 */
@Data
@TableName("user")
@UniqueValid(tableName = "sup_user", columns = {"username", "name"}, message = "用户名或姓名已存在!")
public class UserDto {

    /**
     * id
     */
    @NotBlank(groups = {UpdateGroup.class}, message = "id不能为空")
    private String id;

    /**
     * 主体(CATERING:餐饮单位;CORPORATE:餐饮主体;SUPPLIER:供货商;SUPERIOR:主管单位;)
     */
    @EnumValid(message = "主体不合法", ignoreEmpty = false)
    private OrgEnum org;

    /**
     * 主体id
     */
    private String orgId;

    /**
     * 账号(用户名)
     */
    @NotBlank(message = "账号不能为空")
    private String username;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    private String password;

    /**
     * 姓名
     */
    @NotBlank(message = "姓名不能为空")
    private String name;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 手机(用户名)
     */
    @NotBlank(message = "手机不能为空")
    private String mobile;

    /**
     * 描述
     */
    private String description;

    /**
     * 角色
     */
    @NotEmpty(message = "角色不能为空")
    private List<String> roleIds;

}
